﻿namespace KinonekoSoftware.ArkSpark.Runtimes
{
    partial class ArkSparkMQ
    {
        public DocumentElement GetElement(DocumentElementType type)
        {
            return type switch
            {
                DocumentElementType.Paragraph => CreateParagraph(),
                DocumentElementType.Reference => CreateReference(),
                DocumentElementType.Picture   => CreatePicture(string.Empty),
                _                             => null,
            };
        }
        

        //-------------------------------------------------------------
        //
        //          ParagraphElement
        //
        //-------------------------------------------------------------
        public static ParagraphElement CreateParagraph()
        {
            return new ParagraphElement
            {
                Id = GetID(),
            };
        }

        public static ParagraphElement CreateParagraph(string content)
        {
            return new ParagraphElement
            {
                Id      = GetID(),
                Content = content,
            };
        }
        
        
        //-------------------------------------------------------------
        //
        //          ReferenceElement
        //
        //-------------------------------------------------------------
        public static ReferenceElement CreateReference()
        {
            return new ReferenceElement
            {
                Id = GetID(),
            };
        }

        public static ReferenceElement CreateReference(string content)
        {
            return new ReferenceElement
            {
                Id      = GetID(),
                Content = content,
            };
        }
        
        //-------------------------------------------------------------
        //
        //          HeadingText
        //
        //-------------------------------------------------------------
        public static HeadingText CreateHeadingText(string content, int level = 1)
        {
            return new HeadingText
            {
                Id      = GetID(),
                Content = content,
                Level   = level,
            };
        }

        //-------------------------------------------------------------
        //
        //          PictureElement
        //
        //-------------------------------------------------------------
        public static PictureElement CreatePicture(string source, string content = null)
        {
            return new PictureElement
            {
                Id          = GetID(),
                Description = content,
                Source      = source,
            };
        }

    }
}